This sample code shows the use of the SubreportObject Object. Modify the following sample code to fit your needs.
Class SubreportObject
Dim crystalreport As CRPEAuto.Report
Dim sectsVar As CRPEAuto.Sections
Dim sectVar As CRPEAuto.Section
Dim objs As CRPEAuto.ReportObjects
Dim subObj As CRPEAuto.SubreportObject
Dim test As Integer
Dim crwApplication As CRPEAuto.Application
Private Sub Command1_Click()
'returns the subreport name
test = 1
Set crwApplication = CreateObject("Crystal.CRPE.Application")
Set crystalreport = crwApplication.OpenReport _
("c:\crw\reports\xtreme\wwsales.rpt")
Set sectsVar = crystalreport.Sections
Set sectVar = sectsVar.Item("RF")
Set objs = sectVar.ReportObjects
sortFlds.Add crDescending, "{Customer.Region}"
Set subObj = objs.Item(1)
MsgBox "Name of subreport(autonum.rpt): " & subObj.Name
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |